package edu.java.texbooks.scjp.collections.test07.set.student;

import java.util.Comparator;

public class StudentComparatorByMarks implements Comparator<Student> {
	@Override
	public int compare(Student student1, Student student2) {

		double diff = student1.getMarks() - student2.getMarks();
		if (diff < 0) {
			return -1;
		} else if (diff > 0) {
			return 1;
		} else {
			return 0;
		}
	}
}
